package NWPackage;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class SkewnessMap {
	HashMap<Integer, List<Double>> allSkewnessProbs;
	List<List<String>> allPermutations;
	
	public SkewnessMap(int NumOfCandidates,HashMap<Integer, List<Double>> allSkewnessProbs){
		List<String> dynamicCandidates = new ArrayList<String>();
		//for (int i = 0; i < NumOfCandidates; i++) {  //LIHI CHANGED ON 5/3 IN ATTEMPT TO FIX CAND BUG
		for (int i = 1; i < NumOfCandidates+1; i++) {
			dynamicCandidates.add("" + i);
		}
		try {
			this.allPermutations = Calculations.GetPermutations(dynamicCandidates);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println("ERROR in SKEWNESSMAP");
			e.printStackTrace();
		}
		this.allSkewnessProbs = allSkewnessProbs;
	}
	
	public List<String> getCandidatesList(){
		return allPermutations.get(0);
	}
	
	public List<ProbabilityCell> buildSkewnessListForAgent(String agent, int key) throws Exception{
		List<ProbabilityCell> allPermutationProbs = new ArrayList<ProbabilityCell>();
		int index = 0;
		for (List<String> candidates : allPermutations) {
			ProbabilityCell probCell = new ProbabilityCell(agent,allSkewnessProbs.get(key).get(index),candidates);
			allPermutationProbs.add(probCell);
			index++;
		}
		return allPermutationProbs;
	}
	
	
	
}
